﻿/// <reference path="../GeneratedArtifacts/viewModel.js" />

//*** 删除 Begin ***//
myapp.EditSite.DelectDBInfo_execute = function (screen) {
    screen.getDBInfoCollection().then(function (dbInfos) {
        // Delete selected
        dbInfos.deleteSelected();

        // Save changes
        myapp.commitChanges().then(null, function fail(e) {
            // If error occurs, show the error.
            msls.showMessageBox(e.message, { title: e.title }).then(function () {
                // Cancel Changes
                myapp.cancelChanges();
                throw e;
            });
        });
    });
};
//*** 删除 End ***//

myapp.EditSite.UpLoadImage_execute = function (screen) {
    
    var img = document.querySelectorAll(".msls-image-inner");
    var file = document.createElement("input");
    file.type = "file";
    file.accept = "image/*";
    document.body.appendChild(file);

    file.addEventListener("change", handleFiles, false);
    function handleFiles() {
        //var reader = new FileReader();
        //reader.onload = function (e) {
        //    screen.Site.Image = e.target.result;
        //};
        //reader.readAsDataURL(file.files[0]);

        document.body.removeChild(file);
    }
    file.click();

    
    
};